#ifndef TRAININGCONTROL_H
#define TRAININGCONTROL_H

#include <QDialog>
#include <QImage>
#include <QDebug>
#include <QMouseEvent>
#include <QPoint>
#include <QPainter>
#include <QRubberBand>
#include <QMessageBox>
#include "germtools.h"

using namespace cv;
namespace Ui {
    class TrainingControl;
}

class TrainingControl : public QDialog
{
    Q_OBJECT

public:
    TrainingControl(QWidget *parent = 0);
    ~TrainingControl();
    void addFile(const QString& file);
    void startRunning();
    GermTools* getGTools() { return this->gt; }

private slots:
    void reset();
    void cancel();
    void autoD();
    void manualD();
    void setGrid(QString);

private:
    void display(Mat& src);
    void displayIcon(Mat& src, Rect& roi);
    void drawLine(int grid);
    void setROI(int x, int y, int w, int h);

    Ui::TrainingControl *ui;
    GermTools *gt;
    bool runNNFlag;
    QPoint origin;              // location of mouse press event
    QPointer<QRubberBand> rubberBand;
    Mat img, resultImg, dst;    // original iplimage, result image, destination image

protected:
    void mousePressEvent(QMouseEvent *e);
    void mouseMoveEvent(QMouseEvent *e);
    void mouseReleaseEvent(QMouseEvent *e);

};

#endif // TRAININGCONTROL_H
